<!-- This query shows how to get nodes from different documents merged into a single doccument-->
<!-- So, for return purposes suppose there is a requirement to get the addresses of publishers by books they publish and we are interested in just the shipping address from addresses.xml-->
<results>
{
let $bookdoc := doc("catalog.xml")//book
let $pubdoc := doc("addresses.xml")/publishers/publisher
for $somebook in $bookdoc, 
$somepublisher in $pubdoc
where $somebook/bookcatalog/publisher = $somepublisher/@id
return 
<!-- using XPath expression to isolate the shipping address -->
<result>
{<book>{$somebook/title}</book>,
$somepublisher/address[@type = "shipping"]}
</result>
}
</results>
